/* eslint-disable vue/valid-v-for */
<template>
  <div class="app-container">
    <!--搜索条件-->
    <div class="filter-container">
      <el-row :span="24">
        <el-col :span="4">
          <div class="block">
            <el-date-picker v-model="date" type="month" placeholder="选择月" />
          </div>
        </el-col>
        <el-col :span="4">
          <el-input
            v-model="basicsCnt"
            placeholder="基础拆分量"
            style="width: 150px;"
            class="filter-item"
          />
        </el-col>
        <el-col :span="4">
          <el-input
            v-model="expectReocrdCnt"
            placeholder="期望订单量"
            style="width: 150px;"
            class="filter-item"
          />
        </el-col>
        <el-col :span="4">
          <el-input
            v-model="expectUserCnt"
            placeholder="期望用户量"
            style="width: 150px;"
            class="filter-item"
          />
        </el-col>

        <el-col :span="4">
          <el-button
            class="filter-item"
            type="primary"
            icon="el-icon-search"
            @click="splitCommit"
          >拆分</el-button>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { splitCommit } from '@/api/shipment'
import { parseTime } from '@/utils'
export default {
  data() {
    return {
      date: '',
      basicsCnt: null,
      expectReocrdCnt: null,
      expectUserCnt: null
    }
  },
  created() {},
  methods: {
    splitCommit() {
      debugger
      var data = {
        date: parseTime(this.date, '{y}{m}'),
        basicsCnt: this.basicsCnt,
        expectReocrdCnt: this.expectReocrdCnt,
        expectUserCnt: this.expectUserCnt
      }
      splitCommit(data)
        .then(response => {
          if (response.data.status === 'success') {
            this.$message('拆分失败！')
          }
        })
        .catch(error => {
          console.info(error)
          this.$message('拆分失败！')
        })
    }
  }
}
</script>
